#include "pch.h"
#include "api.h"

Api_Initialize pApi_Initialize;
Api_SendTextMsg pApi_SendTextMsg;
Api_SendTextMsgByteHex pApi_SendTextMsgByteHex;
Api_SendGroupMsgAndAt pApi_SendGroupMsgAndAt;
Api_SendCardMsg pApi_SendCardMsg;
Api_SendImageMsg pApi_SendImageMsg;
Api_SendFileMsg pApi_SendFileMsg;
Api_SendEmojiMsg pApi_SendEmojiMsg;
Api_SendVideoMsg pApi_SendVideoMsg;
Api_SendLinkMsg pApi_SendLinkMsg;
Api_SendMusicMsg pApi_SendMusicMsg;
Api_GetRobotName pApi_GetRobotName;
Api_GetRobotHeadimgurl pApi_GetRobotHeadimgurl;
Api_GetLoggedAccountList pApi_GetLoggedAccountList;
Api_GetFriendList pApi_GetFriendList;
Api_GetGroupList pApi_GetGroupList;
Api_GetGroupMemberList pApi_GetGroupMemberList;
Api_GetGroupMemberDetailInfo pApi_GetGroupMemberDetailInfo;
Api_ReloadPlug pApi_ReloadPlug;
Api_DeleteFriend pApi_DeleteFriend;
Api_ModifyFriendNote pApi_ModifyFriendNote;
Api_BuildingGroup pApi_BuildingGroup;
Api_ModifyGroupName pApi_ModifyGroupName;
Api_ModifyGroupNotice pApi_ModifyGroupNotice;
Api_QuitGroup pApi_QuitGroup;
Api_RemoveGroupMember pApi_RemoveGroupMember;
Api_InviteInGroup pApi_InviteInGroup;
Api_AcceptTransfer pApi_AcceptTransfer;
Api_AgreeFriendVerify pApi_AgreeFriendVerify;
Api_AgreeGroupInvite pApi_AgreeGroupInvite;
Api_GetAppDirectory pApi_GetAppDirectory;
Api_AppendLogs pApi_AppendLogs;
Api_SetFatal pApi_SetFatal;

BOOL APIPROC_CreateApiDllProc() {
    HINSTANCE hDllInst = LoadLibraryA("coupler.dll");
    if (hDllInst != NULL) {
        pApi_Initialize = (Api_Initialize) GetProcAddress(hDllInst, "Api_Initialize");
        pApi_SendTextMsg = (Api_SendTextMsg) GetProcAddress(hDllInst, "Api_SendTextMsg");
        pApi_SendTextMsgByteHex = (Api_SendTextMsgByteHex) GetProcAddress(hDllInst, "Api_SendTextMsgByteHex");
        pApi_SendGroupMsgAndAt = (Api_SendGroupMsgAndAt) GetProcAddress(hDllInst, "Api_SendGroupMsgAndAt");
        pApi_SendCardMsg = (Api_SendCardMsg) GetProcAddress(hDllInst, "Api_SendCardMsg");
        pApi_SendImageMsg = (Api_SendImageMsg) GetProcAddress(hDllInst, "Api_SendImageMsg");
        pApi_SendFileMsg = (Api_SendFileMsg) GetProcAddress(hDllInst, "Api_SendFileMsg");
        pApi_SendEmojiMsg = (Api_SendEmojiMsg) GetProcAddress(hDllInst, "Api_SendEmojiMsg");
        pApi_SendVideoMsg = (Api_SendVideoMsg) GetProcAddress(hDllInst, "Api_SendVideoMsg");
        pApi_SendLinkMsg = (Api_SendLinkMsg) GetProcAddress(hDllInst, "Api_SendLinkMsg");
        pApi_SendMusicMsg = (Api_SendMusicMsg) GetProcAddress(hDllInst, "Api_SendMusicMsg");
        pApi_GetRobotName = (Api_GetRobotName) GetProcAddress(hDllInst, "Api_GetRobotName");
        pApi_GetRobotHeadimgurl = (Api_GetRobotHeadimgurl) GetProcAddress(hDllInst, "Api_GetRobotHeadimgurl");
        pApi_GetLoggedAccountList =
            (Api_GetLoggedAccountList) GetProcAddress(hDllInst, "Api_GetLoggedAccountList");
        pApi_GetFriendList = (Api_GetFriendList) GetProcAddress(hDllInst, "Api_GetFriendList");
        pApi_GetGroupList = (Api_GetGroupList) GetProcAddress(hDllInst, "Api_GetGroupList");
        pApi_GetGroupMemberList = (Api_GetGroupMemberList) GetProcAddress(hDllInst, "Api_GetGroupMemberList");
        pApi_GetGroupMemberDetailInfo =
            (Api_GetGroupMemberDetailInfo) GetProcAddress(hDllInst, "Api_GetGroupMemberDetailInfo");
        pApi_ReloadPlug = (Api_ReloadPlug) GetProcAddress(hDllInst, "Api_ReloadPlug");
        pApi_DeleteFriend = (Api_DeleteFriend) GetProcAddress(hDllInst, "Api_DeleteFriend");
        pApi_ModifyFriendNote = (Api_ModifyFriendNote) GetProcAddress(hDllInst, "Api_ModifyFriendNote");
        pApi_BuildingGroup = (Api_BuildingGroup) GetProcAddress(hDllInst, "Api_BuildingGroup");
        pApi_ModifyGroupName = (Api_ModifyGroupName) GetProcAddress(hDllInst, "Api_ModifyGroupName");
        pApi_ModifyGroupNotice = (Api_ModifyGroupNotice) GetProcAddress(hDllInst, "Api_ModifyGroupNotice");
        pApi_QuitGroup = (Api_QuitGroup) GetProcAddress(hDllInst, "Api_QuitGroup");
        pApi_RemoveGroupMember = (Api_RemoveGroupMember) GetProcAddress(hDllInst, "Api_RemoveGroupMember");
        pApi_InviteInGroup = (Api_InviteInGroup) GetProcAddress(hDllInst, "Api_InviteInGroup");
        pApi_AcceptTransfer = (Api_AcceptTransfer) GetProcAddress(hDllInst, "Api_AcceptTransfer");
        pApi_AgreeFriendVerify = (Api_AgreeFriendVerify) GetProcAddress(hDllInst, "Api_AgreeFriendVerify");
        pApi_AgreeGroupInvite = (Api_AgreeGroupInvite) GetProcAddress(hDllInst, "Api_AgreeGroupInvite");
        pApi_GetAppDirectory = (Api_GetAppDirectory) GetProcAddress(hDllInst, "Api_GetAppDirectory");
        pApi_AppendLogs = (Api_AppendLogs) GetProcAddress(hDllInst, "Api_AppendLogs");
        pApi_SetFatal = (Api_SetFatal) GetProcAddress(hDllInst, "Api_SetFatal");
    } else {
        return FALSE;
    }
    return TRUE;
}
